<?php
session_start();
include "config/koneksi.php";
$username = $_POST['email'];
$pass = md5($_POST['password']);
$cekuser = mysql_query("SELECT * FROM tb_pendaftar WHERE username = '$username'");
$jumlah = mysql_num_rows($cekuser);
$hasil = mysql_fetch_array($cekuser);
if($jumlah > 0) {
echo "Email username sudah ada, silahkan daftar dengan e-mail lain!<br/>";
echo "<a href='sign_up.php'>Back</a>";
} else {
//insert data
$sql="insert into tb_pendaftar(username,password) values ('".$username."','".$pass."')";
$qry=mysql_query($sql);
header('location:view_selamat.php');
}
?>